package edu.zut.hb.software.admin.controller;

import com.alibaba.fastjson.JSON;
import edu.zut.hb.software.admin.domain.User;
import edu.zut.hb.software.admin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/admin/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/findAll")
    public String findAll(){

        List<User> list = (List<User>) userService.list();
        return JSON.toJSONString(list);
    }
}
